package com.dhcc.bpm.modules.cost.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dhcc.bpm.modules.cost.entity.CostRecord;
import com.dhcc.bpm.modules.cost.mapper.CostRecordMapper;
import com.dhcc.bpm.modules.cost.service.ICostRecordService;
import com.dhcc.bpm.modules.cost.vo.ApiCostVO;
import com.dhcc.bpm.modules.cost.vo.AppCostVO;
import com.dhcc.bpm.modules.cost.vo.CostGatewayLogVO;
import com.dhcc.bpm.modules.cost.vo.CostRecordVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName CostRecordServiceImpl.class
 * @Description   消费记录表 服务实现类
 * @Author xiaFaYu
 * @Date 2019-12-16 14:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 */
@Service
public class CostRecordServiceImpl extends ServiceImpl<CostRecordMapper, CostRecord> implements ICostRecordService {

	private CostRecordMapper costRecordMapper;

	/**
	 * @Description 自定义分页
	 * @Author xiafayu
	 * @Date 2020/2/24 15:10
	 * @param page
	 * @param costRecord
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.cost.vo.CostRecordVO>
	 **/
	@Override
	public IPage<CostRecordVO> selectCostRecordPage(IPage<CostRecordVO> page, CostRecordVO costRecord) {
		return page.setRecords(baseMapper.selectCostRecordPage(page, costRecord));
	}

	/**
	 * @Description 自定义分页
	 * @Author xiafayu
	 * @Date 2020/2/24 15:10
	 * @param page
	 * @param apiCostVO
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.cost.vo.ApiCostVO>
	 **/
	@Override
	public IPage<ApiCostVO> selectApiCostRecordPage(IPage page, ApiCostVO apiCostVO) {
		return page.setRecords(baseMapper.selectApiCostRecordPage(page, apiCostVO));
	}

	/**
	 * @Description 自定义分页
	 * @Author xiafayu
	 * @Date 2020/2/24 15:10
	 * @param page
	 * @param appCostVO
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.cost.vo.AppCostVO>
	 **/
	@Override
	public IPage<AppCostVO> selectAppCostRecordPage(IPage page, AppCostVO appCostVO) {
		return page.setRecords(baseMapper.selectAppCostRecordPage(page, appCostVO));
	}
	/**
	 * @Description 根据apiCode查询响应时间成功率
	 * @Author xiafayu
	 * @Date 2020/11/3 16:23
	 * @param apiCode
	 * @return com.dhcc.bpm.modules.cost.vo.CostGatewayLogVO
	 * @throws
	 **/
	@Override
	public CostGatewayLogVO getApiCostByApiCode(String apiCode, String startDate, String endDate) {
		return baseMapper.getApiCostByApiCode(apiCode, startDate, endDate);
	}

	/**
	 * @Description 根据apiCode查询响应时间成功率
	 * @Author xiafayu
	 * @Date 2020/11/3 16:23
	 * @param appCode
	 * @return com.dhcc.bpm.modules.cost.vo.CostGatewayLogVO
	 * @throws
	 **/
	@Override
	public CostGatewayLogVO getApiCostByAppCode(String appCode, String startDate, String endDate) {
		return baseMapper.getApiCostByAppCode(appCode, startDate, endDate);
	}

	@Override
	public List<CostRecord> find(CostRecord opcCostRecord) {
		return baseMapper.find(opcCostRecord);
	}
}
